The online racing simulator
Searching in All forums
(951 results)
Yisc[NL]
S3 licensed
To try and find the issue, you should forward each of the variables to the Lapper console, to see if they have a value.
This can be done like this:

$userName = GetCurrentPlayerVar( "UserName" );
writeline ("DB1: " . $userName);
$X_Axis = "120.65"; #X axis SpawnPoint
writeline ("DB2: " . $X_Axis);

etc etc.
Every variable will now be written to the console and there you can check if they all have a value.
Since some variables are filled with hardcoded numbers, the best guess is that the problem is with one of the variables that get filled with Lapper Vars.
Yisc[NL]
S3 licensed
Do you get an error when using the teleport command?
The Lapper error log is usually very helpful to spot what's going wrong.
Yisc[NL]
S3 licensed
Quote from skorzz :Did you find anything?

Finaly found the time to have a look.
My issue had to do with a problem with an array in a while-loop.
After many debugging, logging, etc. I changed it to a FOREACH-loop and the issue went away.
But bot loops are a not used in your code, so there must be some other issue.
Best thing to do is add a lot of logging and write that to a TXT file.
Then try to reproduce the issue and see what the logfile is showing.
Yisc[NL]
S3 licensed
Congrats on another release.
Yisc[NL]
S3 licensed
Please, keep the conversation in English, so everyone is able to follow it.(and maybe contribute to it as well)
Yisc[NL]
S3 licensed
I am picking my brain as I think I had a similar issue with one of my scripts in the past.
Worked fine with a few players, but went wrong when the amount of players got above a certain point.
Need to dig around in my scripts, to see what script it was and how I fixed or debugged it.
Yisc[NL]
S3 licensed
The code is not working, because it is excluded by using /* (this means, start of the exclude) and */ (this means, end of the exlude).

Also good to know, to exclude a single line, just put a # in front of it and Lapper will ignore that line.
Removing the # will enable it again.

So by removing the start and ending of the exclude, that code should start to work and should look like this:


<?php 
$OnIdleTimeout1 
60# Idle timeout for OnIdleAction1 in seconds

Event OnIdle1$userName # Player event
    
UserGroupFromFile"idleExempt""./idleexempt.txt" );
    IF( 
UserInGroup"idleExempt",$userName ) == )
    
THEN
        privMsg
langEngine"%{main_idle1}%" ) );
    ENDIF
EndEvent

$OnIdleTimeout2 
120# Idle timeout for OnIdleAction2 in seconds

Event OnIdle2$userName # Player event
    
UserGroupFromFile"idleExempt""./idleexempt.txt" );
    IF ( 
UserInGroup"idleExempt",$userName ) == )
    
THEN
        cmdLFS 
"/spec " GetCurrentPlayerVar("Nickname") );
        
privMsg langEngine"%{main_idle2}%" ) );
    ENDIF
EndEvent
?>


Yisc[NL]
S3 licensed
Questions like these can often be answered by checking the file: Changes.txt

The syntax for MoveUserToGroup is: MoveUserToGroup( group, user );

So $blabla should be replaced by the username.
If $UName is the LFS username, you could that.
Otherwise you should use this code:

$userName = GetCurrentPlayerVar("UserName");
Then replace $blabla with $userName
Yisc[NL]
S3 licensed
Great work Victor, thanks for all the efforts.
Yisc[NL]
S3 licensed
The mentioned script is over 12 years old and might not be working in recent versions of Lapper.
Looking at the script, it should spectate a player that is idle for 600 seconds (10 minutes).
Main problem is that the code probably won't work with recent versions of Lapper and has to be converted first.
Yisc[NL]
S3 licensed
This: privDelayedCommand( 0, speed );
Should be: privDelayedCommand( 1, speed );

The number is the amount of seconds before an event is run again.
With it being at 0, it will never execute after the first run.

There might be an issue with this as well: IF ( GetCurrentPlayerVar( "InstantSpeed" ) == 0.03 )

But since I am not at home right now, I cannot check that.
Yisc[NL]
S3 licensed
Without being able to look at your code, we can only take stab in the dark about what is going wrong.
Edit your question and add the code, so it can be checked.
Yisc[NL]
S3 licensed
Maybe the commands are done too quickly, so that Lappers tries to edit something that is not there yet.
This could be solved using a delayed command to a sub event.
Last edited by Yisc[NL], .
Yisc[NL]
S3 licensed
This line has no function: $FileCreationDate = $LinesofFile["TimeOfCreation"];

But that does not create a problem I think.
Does the edit happen when you try this: $NewText = "TESTTEST";

It would also be useful to check the error log and see if any error is reported by Lapper.
Yisc[NL]
S3 licensed
The problem is this line: $Filename = $username;
Should be: $Filename = $userName;
Yisc[NL]
S3 licensed
Have a look at this thread: https://www.lfs.net/forum/thread/92249
Yisc[NL]
S3 licensed
I have run the latest version of both modules and they ran fine. Not with the latest version of Lapper though, so maybe an issue was introduced in one of those versions. Will try to run it on the latest version of Lapper to see what happens at my end.
Yisc[NL]
S3 licensed
Is the Lapper log showing any errors?
What version of LFS and Lapper are you using?
Yisc[NL]
S3 licensed
That's not possible in the current version of Lapper.
Yisc[NL]
S3 licensed
The PlayerVar is only working when server setting is set to: /showfuel=yes

If so, the amount of fuel (as a percentage) is shown when the player leaves the pits.
So in order to get the percentage being displayed, you have add your code into this event: OnNewPlayerJoin
Yisc[NL]
S3 licensed
Yes, you can record the time when someone logs on and when someone logs off. Then it's easy to calculate time spent: Log off - log on
You could even store that into the Lapper database if you want to keep track of a total time spent.
Yisc[NL]
S3 licensed
You can use the Round function.
The correct syntax is: Round(Var,2)

Var is the variable you want to be rounded.
2 is the value that sets the amount of decimals.
In your case the syntax should be: Round(Var,0)
Yisc[NL]
S3 licensed
Sure, you can make it 20 seconds (or any time you want).
Adjust the code to use the long time-format of Lapper, add the seconds and add an extra check to see if seconds have gone above 60.
Yisc[NL]
S3 licensed
Maybe you only want the tempo control on certain commands.
That's possible by adding this sub-event:


<?php 
Sub pace_control_command
$KeyFlags,$id )
    IF (
GetLapperVar("ShortTime") >= GetCurrentPlayerVar"control_commands"))
    
THEN
      $time_splitted 
SplitToArrayGetLapperVar("ShortTime"),":" ); #split ShortTime into an array
      
$time_splitted[1] = $time_splitted[1] + 1#add one minute to the current minutes

      # Check if minutes has value 60 or above. If so, raise hours by one and lower minutes by sixty
      
IF ($time_splitted[1] >= 60)
      
THEN
        $time_splitted
[0] = $time_splitted[0] + 1;
        
$time_splitted[1] = $time_splitted[1] - 60;
      ENDIF

      
# Check if hours has value 24. If so, reduce hours by 24
      
IF ($time_splitted[0] == 24)
      
THEN
        $time_splitted
[0] = $time_splitted[0] - 24;
      ENDIF

      
# Merge hours and minutes into one value
      
$pace_control "" $time_splitted[0] . ":" $time_splitted[1];

      
# Set player var 'control_command' to the new time stamp
      # Set player var 'control_command_allowd' to "yes"
      
SetCurrentPlayerVar"control_commands"$pace_control );
      
SetCurrentPlayerVar"control_commands_allowed""yes" );
    ELSE
      
# Set player var 'control_command_allowd' to "no"
      
SetCurrentPlayerVar"control_commands_allowed""no" );
    ENDIF
EndSub
?>


Then the command you want to check on, should look like this:


<?php 
        
CASE "!test":
            
pace_control_command0,);
            IF (
GetCurrentPlayerVar"control_commands_allowed" ) == "yes" )
            
THEN
              MyTest
();
            ELSE
              
PrivMsg("^1You have to wait until it is ^3(" GetCurrentPlayerVar"control_commands") . ")^1 , to be able to execute this command");
            ENDIF
            BREAK;
?>

Last edited by Yisc[NL], .
Yisc[NL]
S3 licensed
Add this piece of code to Event OnMSO above this line:

SWITCH( $command )


<?php 
    
IF (GetLapperVar("ShortTime") >= GetCurrentPlayerVar"control_commands"))
    
THEN
      $time_splitted 
SplitToArrayGetLapperVar("ShortTime"),":" ); #split ShortTime into an array
      
$time_splitted[1] = $time_splitted[1] + 1#add one minute to the current minutes

      # Check if minutes has value 60 or above. If so, raise hours by one and lower minutes by sixty
      
IF ($time_splitted[1] >= 60)
      
THEN
        $time_splitted
[0] = $time_splitted[0] + 1;
        
$time_splitted[1] = $time_splitted[1] - 60;
      ENDIF

      
# Check if hours has value 24. If so, reduce hours by 24
      
IF ($time_splitted[0] == 24)
      
THEN
        $time_splitted
[0] = $time_splitted[0] - 24;
      ENDIF

      
# Merge hours and minutes into one value
      
$pace_control_time "" $time_splitted[0] . ":" $time_splitted[1];

      
# Set player var 'control_command' to the new time stamp
      
SetCurrentPlayerVar"control_commands"$pace_control_time );
?>

Add this piece of code to Event OnMSO the after this line:

ENDSWITCH


<?php 
    
ELSE
      
PrivMsg("^1You have to wait until it is ^3(" GetCurrentPlayerVar"control_commands") . ")^1 , to be able to execute a command");
    ENDIF
?>

FGED GREDG RDFGDR GSFDG